package com.yuma.order.controller;

import com.yuma.order.entity.Order;
import com.yuma.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;
    
    @GetMapping("/create")
    public String create(Long userId, Long productId, Integer count, BigDecimal money) {
        Order order = new Order();
        order.setUserId(userId).setProductId(productId).setCount(count).setMoney(money);
        orderService.create(order);
        return "订单创建成功，订单号:id = " + order.getId();
    }
}
